<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="gae.colopl.*" %>
<%@ page import="gae.colopl.bean.*" %>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
<!-- above set at the top of the file will set     -->
<!-- the browser's rendering engine into           -->
<!-- "Quirks Mode". Replacing this declaration     -->
<!-- with a "Standards Mode" doctype is supported, -->
<!-- but may lead to some differences in layout.   -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Hello App Engine</title>
  </head>
  
  <body>
    <h2>アイテム倉庫内検索</h2>
  <%
  User user = (User)session.getAttribute("userInfo");
  String pageUrl = response.encodeUrl("http://colopl.jp/s/itemWH.do?id=" + user.getId() + "&uid=" + user.getUid() + "&guid=ON");
  List<SetWarehouseItem> list = (List<SetWarehouseItem>)session.getAttribute("set.warehouseitem");
  int succeed = 0;
  int failed = 0;
  String reason = null;
  Iterator<SetWarehouseItem> ite = list.iterator();
  while (ite.hasNext()) {
      SetWarehouseItem item = ite.next();
      if (item.isSuccess()) {
          succeed++;
      } else {
          failed++;
          if (item.getReason() != null) {
              reason = item.getReason();
          }
      }
  }
  %>
  <div>成功：<%=succeed %>個</div>
  <div>失敗：<%=failed %>個</div>
  <%
  if (reason != null) {
  %>
  <div>失敗の理由：<%=reason %></div>
  <%
  }
  %>
  <br>
  <div><a href="<%=response.encodeUrl("searchWareHouse.do") %>">ｱｲﾃﾑの検索に戻る</a></div>
  <div><a href="<%=pageUrl %> ">倉庫を見に行く</a></div>
<br>
<br>
<div><a href="<%=response.encodeUrl("searchWareHouse.do?type=doc") %>">使い方</a></div>
<div><a href="<%=response.encodeUrl("menu.do") %>">メニュー</a></div>
<br>
<div><a href="<%=response.encodeUrl("logout.do") %>">ログアウト</a></div>
</body>
</html>